import request from '@/utils/request'

export const getCity = ()=>{
    return request.get('/local/city')
}

export const userReg = (info)=>{  //注册
    return request.post('/node/users',info)
}

export const userLogin = (info)=>{  //登录
    return request.get('/node/users',{
        params:info
    })
}

// export const userLogin = (info)=>{  //登录
//     return request.get('http://localhost:3003/users',{
//         params:info
//     })
// }

export const userUpdate = (_id,info)=>{  //更新用户信息,info是新的信息
    return request.put('/node/users',{
        _id,info
    })
}

export const cartAdd = (cartData)=>{  //加入购物车
    return request.post('/node/users/cart',cartData)
}

export const cartGet = (userid)=>{  //加载购物车数据
    return request.get('/node/users/cart?userid='+userid)
}

export const cartUpdate = (_id,num)=>{  //加载购物车数据
    return request.put('/node/users/cart',{
        _id,num
    })
}